var http = require('http')

var fs = require('fs')

var server = http.createServer()

server.on('request', function(req, res) {

    if (req.url === "/index") {

        fs.readFile('../请求内容/index.html', function(error, data) {
            res.setHeader('Content-Type', 'text/html;charset="utf-8')
            res.end(data)
        })
    } else if (req.url === "/image") {
        fs.readFile('../请求内容/image/1.jpg', function(error, data) {
            res.setHeader('Content-Type', 'image/jpeg;charset="utf-8')
            res.end(data)
        })
    }

})

server.listen(3000, function() {
    console.log('server is runing...')
})